﻿namespace Lab3_5Tests
open NUnit.Framework
open FsUnit
open Lab3_5
open Helper

[<TestFixture>]
type ``Testing lab 3 5`` ()=
  let y1 x = x / ((3.0 * x + 4.0) ** 2.0)
  let a, b = -1.0, 1.0
  let h1, h2 = 0.5, 0.25
  [<Test>] 
  member t.``Rectangle method`` ()=
    rectangle a b y1 h1 |> should equal -0.11914313291347781
    rectangle a b y1 h2 |> should equal -0.14931195938119501
    rectangle a a y1 h2 |> should equal 0.0
  [<Test>] 
  member t.``Trapeze method`` ()=
    trapeze a b y1 h1 |> should equal -0.27663349637375617
    trapeze a b y1 h2 |> should equal -0.19788831464361698
    trapeze b b y1 h2 |> should equal 0.0
  [<Test>] 
  member t.``Simpson method`` ()=
    simpson a b y1 h1 |> should equal -0.20557935570922584
    simpson a b y1 h2 |> should equal -0.1716399207335706
    simpson a a y1 h2 |> should equal 0.0
  [<Test>] 
  member t.``RRR method`` ()=
    let clarify = RRR a b y1 h1 h2 
    clarify 2.0 rectangle |> should equal -0.15936823487043408
    clarify 2.0 trapeze |> should equal -0.1716399207335706
    clarify 4.0 simpson |> should equal -0.16937729173519359
